
class TapShake {
  // 防止二次点击
  static DateTime? _lastTime;
  static preventDoubleTap({int interval = 800}) {
    DateTime nowTime = DateTime.now();
    if (_lastTime == null ||
        nowTime.difference(_lastTime!) > Duration(milliseconds: interval)) {
      _lastTime = nowTime;
      return true;
    } else {
      _lastTime = nowTime;
      return false;
    }
  }
}
